package io.gitee.zhangbinhub.admin.log.entity

import io.gitee.zhangbinhub.acp.core.common.CalendarTools
import io.gitee.zhangbinhub.admin.log.base.BaseLogEntity
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.persistence.*

/**
 * @since JDK 11
 */
@Entity
@Table(
    name = "t_log_login",
    uniqueConstraints = [UniqueConstraint(columnNames = ["logId", "requestTime"])],
    indexes = [
        Index(columnList = "requestTime"),
        Index(columnList = "userId"),
        Index(columnList = "clientId,loginDate"),
        Index(columnList = "userId,clientId,loginDate")
    ]
)
@Schema(description = "登录日志")
data class LoginLog(
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    @Column(length = 36, nullable = false)
    @field:Schema(description = "ID")
    var id: String = "",

    @Column(nullable = false)
    @field:Schema(description = "登录日期")
    var loginDate: String = CalendarTools.getDateTimeString(null, CalendarTools.DATE_FORMAT)
) : BaseLogEntity()